/*
 * @Author: lsy
 * @Date: 2023-02-14 22:35:49
 * @LastEditors: lsy
 * @LastEditTime: 2023-02-21 13:09:08
 * @Description: 请填写简介
 */

import schoolAPI from '@/api/model/school';
import { Sex_Enum, FamilyRelation_Enum } from '@/enums/common.js';

export const studentFormItems = [

  {
    label: "学员姓名",
    prop: "name",
  },
  {
    label: "学员生日",
    prop: "birthday",
    component: 'el-date-picker',
    style: {
      width: '100%'
    },
  },
  {
    label: "学员性别",
    prop: "sex",
    component: 'el-select',
    options: Sex_Enum,
  },
  // {
  //   label: '联系人姓名',
  //   prop: "familyName",
  // },
  // {
  //   label: "联系人手机",
  //   prop: "familyPhone",
  // },
  // {
  //   label: "亲属关系",
  //   prop: "familyRelation",
  //   component: 'el-select',
  //   options: FamilyRelation_Enum,
  // },
  {
    label: "所属校区",
    prop: "schoolId",
    labelKey: 'schoolName',
    component: 'remote-select',
    remoteMethod(params, resolve) {
      schoolAPI.dropdown.get(params).then(res => {
        if (res.code === 200) {
          resolve(res.data.records.map(i => {
            return {
              label: i.abbreviation,
              value: i.schoolId
            }
          }))
        }
      })
    },
    props: {
      clearable: true,
      placeholder: '请输入要查找的校区',
      style: {
        width: '100%'
      }
    }
  },
  {
    label: "身份证号",
    prop: "idCard",
  },
  {
    label: "地址",
    prop: "address",
  },
  {
    label: "邮箱",
    prop: "email",
  },
  // {
  //   label: "紧急联系人",
  //   prop: "emergencyContact",
  // },
  // {
  //   label: "紧急联系人电话",
  //   prop: "emergencyTelephone",
  // },
  // {
  //   label: "转介绍学员",
  //   prop: "recommendStudentId",
  //   slot: 'referStudent',
  // },
  // {
  //   label: "转介绍员工",
  //   prop: "recommendStudentId",
  //   slot: 'referEmployees',
  // },
  {
    label: "备注",
    prop: "remark",
    component: 'el-input',
    type: 'textarea'
  },
]

export const rules = {
  name: {
    required: true,
    message: '请输入学员姓名',
  },
  birthday: {
    required: true,
    message: '请输入学员生日',
  },
  sex: {
    required: true,
    message: '请选择学员性别',
  },
  familyName: {
    required: true,
    message: '请输入联系人姓名'
  },
  familyPhone: {
    required: true,
    message: '请输入联系人手机'
  },
  familyRelation: {
    required: true,
    message: '请选择亲属关系'
  },
  schoolId: {
    required: true,
    message: '请选择所属校区'
  },
  grade: {
    required: true,
    message: '请输入学员年级'
  },
}
